#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include <time.h>
int main()
{
	int i,j;
	int x=5;
	int y=5;
	char input;
	int ny=5;
	int fire=0;
	int kill=0;
	int score=0;
	srand(time(NULL));
	while(1)
	{
		system("cls");
		if(kill==0)
		{
			for(i=0;i<ny;i++)
				printf(" ");
			printf("+\n");
		}
		else 
		{
			
			for(i=0;i<ny;i++)
				printf(" ");
			printf(" \n");
			score++;
			kill=0;
			ny=rand()%11+5;
		}
		if(fire==0)
		{
			for(i=0;i<x;i++)
			printf("\n");
		}
		else
		{
			for(i=0;i<x;i++)
			{
            for(j=0;j<y;j++)
			printf(" ");
			printf("  |\n");
			}
			if(y+2==ny)
				kill=1;
			fire=0;
		}
		for(j=0;j<y;j++)
			printf(" ");
		printf("  *\n");
		for(j=0;j<y;j++)
			printf(" ");
		printf("*****\n");
		for(j=0;j<y;j++)
			printf(" ");
		printf(" * *\n");
        printf("得分：%d",score)
		input=getch();
		if(input=='s')
			x++;
		if(input=='w')
			x--;
		if(input=='a')
			y--;
		if(input=='d')
			y++;
		if(input==' ')
			fire=1;
		}
	return 0;
}
